package com.yiqi.liebang.feature.wallet.model;

import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.yiqi.liebang.entity.bo.BanlanceBo;
import com.yiqi.liebang.entity.bo.PageBo;
import com.yiqi.liebang.entity.bo.PayBo;
import com.yiqi.liebang.entity.bo.PublicBo;
import com.yiqi.liebang.entity.bo.RechargeBo;
import com.yiqi.liebang.feature.wallet.contract.WalletContract;
import com.yiqi.liebang.feature.wallet.dependencies.wallet.DaggerWalletModelComponent;
import com.yiqi.liebang.framework.api.ApiLib;
import com.yiqi.liebang.framework.api.HomeApi;

import javax.inject.Inject;

import io.reactivex.Observable;

public class WalletModel implements WalletContract.Model {

    @Inject
    HomeApi api;


    @Inject
    public WalletModel() {

        DaggerWalletModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<PayBo> userRechagre(RechargeBo rechargeBo) {
        return api.userRecharge(rechargeBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<PublicBo> userWithdraw(RechargeBo rechargeBo) {
        return api.userWithdraw(rechargeBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<BanlanceBo> getUserAssetsDetail(PageBo rechargeBo) {
        return api.getUserAssetsDetail(rechargeBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
